//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "tools\fn_translate.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);

private ["_name_array","_is_translation_string","_translated","_trans_array","_initial"];
_translated = "";
if (IS_ARRAY(_this)) then {
	_trans_array = [];
	{
		_trans_array set[ count _trans_array, (_x call CFUNC(translate))];
	} foreach _this;
	_translated = format _trans_array;
} else {
	_name_array = _this;
	_translated = _name_array;
	_initial = _translated;
	if (typename _name_array != typename "") then { _name_array = str(_name_array); };
	_name_array = toArray(_name_array);
	if (count _name_array > 4) then {
		If (	((_name_array select 0) == 83)	// S
			AND ((_name_array select 1) == 84)	// T
			AND ((_name_array select 2) == 82)	// R
			AND ((_name_array select 3) == 95)	// _
		) then {
			_translated = localize _translated;
			if (_translated == "") then { _translated = _initial;};
		};
	};
};
TRACE_1("End",_translated);
_translated;